package com.elh.es.participle.matchlength;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author liulei
 **/
public class Segmenter {

    private static Segmenter segmenter = null;

    static {
        try {
            List<String> contentList1 = new ArrayList<>();
            FileReader fileReader = new FileReader("D:\\1.txt");
            BufferedReader reader = new BufferedReader(fileReader);
            String line = null;
            while (((line = reader.readLine()) != null)) {
                String[] split = line.split("\\t");
                for (String s : split) {
                    contentList1.add(s);
                }
            }
            reader.close();
            segmenter = new Segmenter(contentList1);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }


    private List<String> contentList;

    public Segmenter(List<String> contentList) {
        this.contentList = contentList;
    }

    public List<String> getContentList() {
        return contentList;
    }

    public void setContentList(List<String> contentList) {
        this.contentList = contentList;
    }

    public static Segmenter getSegmenter() {
        return segmenter;
    }

}
